Skip to main content

WhatsApp Template APIs

The WhatsApp Template APIs allow businesses to create and manage pre-approved WhatsApp message templates. These templates are required to send outbound WhatsApp messages and support dynamic parameters, media headers, and interactive buttons.


Prerequisites

Before using the WhatsApp Template APIs, ensure the following:

  1. WhatsApp Business Account
    Your business must be onboarded for WhatsApp messaging through Msgkart.

  2. Business ID
    A valid Msgkart Business ID is required.

  3. API Key
    An active API key provided by Msgkart.
    This must be passed in request headers as x-api-key.

  4. Template Approval
    All templates must be approved by WhatsApp before they can be used.


Create WhatsApp Template

This API allows you to create a WhatsApp message template under your business account. Once approved, the template can be used to send WhatsApp messages to end users.


Request Syntax

POST /api/v1/template/{{BUSINESS ID}}

Request headers

    "x-api-key": "<API KEY>"

Interactive Template – Without Image & Without Variables

Request Body

{
"name": "{{templateName}}",
"language": "{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}"
}
]
}


Interactive Template – Without Image & With Variables

Request Body

{
"name": "{{templateName}}",
"language": "{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
}
]
}

Interactive Template – With Image & With Variables

Request Syntax

POST /api/v1/template/media/{{BUSINESS ID}}

Request headers

    "x-api-key": "<API KEY>"

Request Body

{
"name": "{{templateName}}",
"language":"{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [

]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "{{buttonText}}"
},
{
"type": "PHONE_NUMBER",
"text": "{{buttonText}}",
"phone_number": "{{phoneNumber}}"
},
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}"
}
]
}
],
}

Image (Binary Format)

  • Image must be sent as binary file, not as a URL
  • Use the form-data key files to upload the image
  • Leave header_handle empty in the JSON payload

Request Syntax

POST /api/v1/template/media/{{BUSINESS ID}}

Request headers

    "x-api-key": "<API KEY>"

Request Body

{ 
"name": "{{templateName}}",
"language":"{{templateLanguage}}",
"category": "{{templateCategory}}",
"components": [
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}",
"{{example2}}"
]
]
}
},
{
"type": "CAROUSEL",
"cards": [
{
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [

]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}",
"example": [
"{{example1}}"
]
}
]
}
]
},
{
"components": [
{
"type": "HEADER",
"format": "IMAGE",
"example": {
"header_handle": [
]
}
},
{
"type": "BODY",
"text": "{{bodyText}}",
"example": {
"body_text": [
[
"{{example1}}"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "URL",
"text": "{{buttonText}}",
"url": "{{url}}",
"example": [
"{{example1}}"
]
}
]
}
]
}
]
}
],
}

Image (Binary Format)

  • Image must be sent as binary file, not as a URL
  • Use the form-data key files to upload the image
  • Leave header_handle empty in the JSON payload

Response Body


{
"id": "{{templateId}}",
"status": "{{templateStatus}}",
"category": "{{templateCategory}}"
}

Properties

FieldDescriptionExample
x-api-keyAPI key for authentication (request header){{apiKey}}
nameUnique WhatsApp template name{{templateName}}
languageTemplate language code{{templateLanguage}}
categoryWhatsApp template category{{templateCategory}}
componentsMessage structure (BODY, HEADER, BUTTONS, etc.)